package com.sx.gongzhong.pest;

import com.sx.gongzhong.model.CommentBean;
import com.sx.gongzhong.model.HeadParamBean;
import com.sx.gongzhong.model.ReplyUserBean;
import com.sx.gongzhong.net.AppealManager;
import com.sx.gongzhong.net.BaseCallBack;
import com.sx.gongzhong.model.BasePageListBean;
import com.sx.gongzhong.view.ConvennicAppealReplyView;

import java.util.Map;

/**便民訴求答復 便民訴求评论
 * Created by admin on 2018/1/10.
 */

public class ConvennicAppealReplyPest {
    private ConvennicAppealReplyView convennicAppealReplyView;

    public ConvennicAppealReplyPest(ConvennicAppealReplyView convennicAppealReplyView) {
        this.convennicAppealReplyView = convennicAppealReplyView;
    }

    public void getAppealReplyList(String replyId,int page,int rows){
        Map<String,Object> map = HeadParamBean.getHead();
        map.put("dataId",replyId);
        map.put("page",page);
        map.put("rows",rows);
        new AppealManager().getAppealReplyList(map, new BaseCallBack<ReplyUserBean.BaseResult<BasePageListBean<CommentBean>>>() {
            @Override
            public void onSuccess(ReplyUserBean.BaseResult<BasePageListBean<CommentBean>> response) {
                convennicAppealReplyView.getAppealReplyListSuccess(response.data.rows,response.data.total);
            }
            @Override
            public void onFailures(String message) {
                convennicAppealReplyView.showError(message);
            }
        });
    }

    public void getAppealCommentList(String commentId,int page,int rows){
        Map<String,Object> map = HeadParamBean.getHead();
        map.put("dataId",commentId);
        map.put("page",page);
        map.put("rows",rows);
        new AppealManager().getAppealCommentList(map, new BaseCallBack<ReplyUserBean.BaseResult<BasePageListBean<CommentBean>>>() {
            @Override
            public void onSuccess(ReplyUserBean.BaseResult<BasePageListBean<CommentBean>> response) {
                convennicAppealReplyView.getAppealReplyListSuccess(response.data.rows,response.data.total);
            }
            @Override
            public void onFailures(String message) {
                convennicAppealReplyView.showError(message);
            }
        });
    }
}
